/* 
 * File:   HttpServerEventListener.h
 * Author: dell
 *
 * Created on 2012年4月4日, 下午10:25
 */

#ifndef HTTPSERVEREVENTLISTENER_H
#define	HTTPSERVEREVENTLISTENER_H

#include "common.h"
#include <evhttp/event/IEventListener.h>
#include <evhttp/events.h>
#include "ChildProcessQuitHandler.h"
#include "MainProcessQuitHandler.h"

namespace Rapid{
    class RapidServer;
    class HttpServerEventListener: public IEventListener{
    public:
        HttpServerEventListener(RapidServer* rapidServer);
        virtual ~HttpServerEventListener();

        
    protected:        
        virtual bool handle(const Event* e);

        bool onProcessStartedEvent(const ProcessStartedEvent* e);
        
        bool onProcessReceiveMessageEvent(const ProcessReceiveMessageEvent* e);
        
    private:
        RapidServer* rapidServer;
        MainProcessQuitHandler mainProcessQuitHandler;
        ChildProcessQuitHandler childProcessQuitHandler;
    };
}
#endif	/* HTTPSERVEREVENTLISTENER_H */

